import GCJ_CLASS_TYPE = require('./../../common/GCJ_CLASS_TYPE');
import Serializer = require('./../base/Serializer');
import SJGReplaceItemBase = require('./SJGReplaceItemBase');
import SJGReplaceItemGroup = require('./SJGReplaceItemGroup');
import CommonModel = require('./../../common/model/CommonModel');


var CONFIG=require('../../../../common/config');
export  = SJGReplaceItemTableRow;

/**
 * 表格行
 * @author 
 *
 */
class SJGReplaceItemTableRow extends SJGReplaceItemGroup{
    public rowType: number=0;// 行类型，见TableRowObj 的ROW_TYPE_NORMAL 和ROW_TYPE_TITLE
    
    public constructor(g?) {
        super(g);

        this.ct = GCJ_CLASS_TYPE.CLASS_TYPE_SJGReplaceItemTableRow;
        this.type=SJGReplaceItemBase.TYPE_TABLE_ROW;
    }
    
    // 从json对象(注意不是json字符串)中解析
    public fromJson(jsonObj,versionId) {
        super.fromJson(jsonObj,versionId);
        
        if(jsonObj.hasOwnProperty("rowType")) {
            this.rowType=jsonObj.rowType;
        }
    }
    
    // 转成json字符串
    public toJson(): string {
        // 去掉父json字符串的头尾
        var superJson = super.toJson();
        superJson = superJson.substr(1,superJson.length - 2);

        var ret = '{';
        ret += superJson;
        
        ret+=',';
        ret+='"rowType":'+this.rowType;
        
        ret += '}';
        return ret;
    }
    // 获取对象名称
    public getObjetName(): string {
        return "表格行";
    }
}//SJG_MARK_END-------------------------
